package com.youlu.campus.website.controller;

import com.youlu.campus.common.base.QResult;
import com.youlu.campus.website.entity.ContactMessage;
import com.youlu.campus.website.service.ContactMessageService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 联系我们留言控制层
 *
 * @author su
 * @date 2025/08/30
 */
@RestController
@RequestMapping("/api/contact/message")
public class ContactMessageController {

    @Resource
    private ContactMessageService contactMessageService;

    /**
     * 新增留言
     *
     * @param contactMessage 留言实体
     * @return QResult<ContactMessage>
     */
    @PostMapping("/save")
    public QResult<ContactMessage> saveMessage(@RequestBody ContactMessage contactMessage) {
        ContactMessage save = contactMessageService.saveMessage(contactMessage);
        return QResult.success(save);
    }
}